<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        // 算术运算中先将两边的值转换成number再运算
        // 特殊：+运算除外
        var a="12";
        var b=3;
        var c="12px";
        // 12px转成数值型还是nan
        var d;
        // console.log(number(a)-b);
        console.log(a-b);
        // console.log(number(c)-b); NaN和其他值做运算还是nan
        console.log(c-b);
        // console.log(number(a)-number(d));
        console.log(a-d);
    </script>
</body>
</html>